﻿using M.ShopMachine.Repository.Interface;
using M.ShopMachine.Write.WebApi.Application.Command.WorkshopCommand;
using MediatR;

namespace M.ShopMachine.Write.WebApi.Application.Handler.WorkshopHandler
{
    public class UpdWorkshopHandler : IRequestHandler<UpdWorkshopCommad, int>
    {
        private readonly IWorkshopRepository workshopRepository;

        public UpdWorkshopHandler(IWorkshopRepository workshopRepository)
        {
            this.workshopRepository = workshopRepository;
        }

        public async Task<int> Handle(UpdWorkshopCommad request, CancellationToken cancellationToken)
        {
            return await workshopRepository.UpdWorkShopAsync(request);
        }
    }
}
